package Client;

import Model.Payload;
import Model.Queue;

public class ThreadClient extends Thread {
	private Queue queue;
	private Payload payload;
	
	public ThreadClient(Queue queue) {
		this.queue = queue;
	}
	
	@Override
	public void run() {
		while (true) {
			payload = queue.next();
			
			if (payload != null) {
				if (payload.getState().equals("WAITING")) {
					queue.sendPayload("192.168.0.100", 1234, payload);
					payload.setState("SEND");
				}
			}
		}
	}
}
